home *** CD-ROM | disk | FTP | other *** search
- Attribute VB_Name = "JMDialog"
- Option Explicit
-
- '
- ' Set Common Dialog Position
- Public Sub jmSetCommonDialogPosition(Action As Integer, ctlContl As Control)
- '
- ' Action is as follows :-
- '
- ' ShowOpen = 1
- ' ShowSave = 2
- ' ShowColor = 3
- ' ShowFont = 4
- ' ShowPrinter = 5
- Dim wrkOffsetLeft As Integer
- Dim wrkOffsetTop As Integer
- '
- ' Set Error Trap
- On Error GoTo jmSetCommonDialogPositionError
- '
- ' Set Height and Width
- MyCDForm.Width = 6000
- MyCDForm.Height = 3600
- '
- ' Set Offset
- wrkOffsetLeft = 0
- wrkOffsetTop = 0
- Select Case Action
- Case 4
- wrkOffsetLeft = -360
- wrkOffsetTop = -1320
- Case 5
- wrkOffsetLeft = -840
- wrkOffsetTop = -840
- End Select
- '
- ' Set Top and Left
- MyCDForm.Top = jmAbsoluteTop(ctlContl) + ctlContl.Height + wrkOffsetTop + 360
- MyCDForm.Left = ctlContl.Parent.Left + wrkOffsetLeft + 240
- '
- ' Do Nothing if An Error
- jmSetCommonDialogPositionError:
- Exit Sub
- End Sub
-
- '
- ' Absolute Top Position Function
- Public Function jmAbsoluteTop(ctlContl As Control) As Single
- Dim wrkContl As Control ' Working Control
- Dim wrkTopPos As Single ' Calculated Top Position
- '
- ' Set Error Trap
- On Error GoTo jmAbsoluteTopError
- '
- ' Initialise Working Control
- Set wrkContl = ctlContl
- '
- ' Set Initial Top Position
- wrkTopPos = 0
- '
- ' Loop until the Container is the Parent
- Do
- If (wrkContl.Container.Name = ctlContl.Parent.Name) Then Exit Do
- wrkTopPos = wrkTopPos + wrkContl.Top ' Calculate Top Position
- Set wrkContl = wrkContl.Container ' Set Next Control
- Loop
- '
- ' Return Absolute Position
- jmAbsoluteTop = wrkTopPos + ctlContl.Parent.Top
- Exit Function
- '
- ' Return a Sensible Value if an Error
- jmAbsoluteTopError:
- jmAbsoluteTop = ctlContl.Top + ctlContl.Parent.Top
- Exit Function
- End Function
-
-